package net.linxuehua.server.dto;/**
 * @author chenyan
 * @createTime 2021/1/12 9:39
 * @description description
 */

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.linxuehua.server.po.Food;


@Data
public class FoodDTO {
    /**
     * 自增id
     */
    @ApiModelProperty(value = "自增id", dataType = "int")
    private Integer foodId;

    /**
     * 食材名称
     */
    @ApiModelProperty(value = "食材名称", dataType = "String")
    private String foodName;

    /**
     * 图片
     */
    @ApiModelProperty(value = "图片", dataType = "String")
    private String url;

    /**
     * 描述
     */
    @ApiModelProperty(value = "描述", dataType = "String")
    private String description;

    /**
     * 价格
     */
    @ApiModelProperty(value = "价格", dataType = "int")
    private int price;

    /**
     * 食材数量
     */
    @ApiModelProperty(value = "食材数量", dataType = "int")
    private int foodNum;

    public Food toFood() {
        Food food = new Food();
        if (this.getFoodId() != null && this.getFoodId() != 0) {
            food.setFoodId(this.getFoodId());
        }
        food.setDescription(this.description);
        food.setFoodName(this.foodName);
        food.setPrice(this.price);
        food.setUrl(this.url);
        food.setFoodNum(this.foodNum);
        return food;
    }


}
